package com.sujiewon.salesadmin.common.service;

import java.sql.SQLException;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sujiewon.salesadmin.common.dao.VisitDao;

@Service
public class VisitServiceImpl implements VisitService {

	@Resource(name="visitDaoImpl")
	private VisitDao visitDao;
	
	@Override
	public void makeVisitCount(String date) throws SQLException {
		if(this.visitDao.isExistTodayCnt(date)){
			this.visitDao.updateTodayCnt(date);
		} else {
			this.visitDao.insertTodayCnt(date);
		}
	}

	@Override
	public int getTotalVisitCnt() throws SQLException {
		return this.visitDao.getTotalCnt();
	}

	@Override
	public int getTodayVisitCnt(String date) throws SQLException {
		return this.visitDao.getTodayCnt(date);
	}

}
